//
//  global.cpp
//  NLCEQ_mixed
//
//  Created by Duong Ngo on 8/5/16.
//  Copyright © 2016 Duong Ngo. All rights reserved.
//

#include "global.hpp"
#include <math.h>

/* GLOBAL PARAMETERS */


//Bankers
const double varphi=0.002;      // Reserves Requirement
const double beta_b = 0.99;      // Bankers's discount factor
const double Rn=  1+0.25/400;  // Lower bound of interest on reserves
const double kappa=0.22;         // Capital requirement
const double thetaa=0.0005;     // Cost of collecting loan
const double deltab= 0.5;       // Loan amortization


//Households
const double beta_h = 0.985;      // Household's discount factor
const double epsilon= 4;        // Elasticity of substitution
const double alphaa=0.34;       // Parameters in production function
const double deltak = 0.025;    // Capital depriciation
const double iota=100;           //Nominal Price Rigidity
const double chi= 0.586;        // Labor disutility
const double bh_limit= 3.4;     // Borrowing limit
const double nu = 0.5;          // Inverse Frisch elasticity


//Government policy
const double phipie= 1.25;    //Policy repsonds to inflation
const double phiy= 0; //Policy respond to output gap

//Shock
const double rho = 0.95; // Persistence of capital shock
const double rho_rf= 0.6; // Persistence of IR shock


//FOC Problem
const int var_foc= 25; //Number of variables in each period
const int dim_state= 5; // Number of state variables
const int dim_forward= 8; // Number of foward variables
const int T= 300; // Number of periods

//Other variables
const double s_max= 1e6;    // Coefficient in soft-max constraint
const double Rf_min= 1+0.5/400; // The minimum of FFR > Rn
double max_error=0; //Check the maximum error
const double pe= 1e4;
const int T_forward= 8;   // Number of period in forward guidance




// Global vector
std::vector<double> result(var_foc);  // Store result in Ipopt
std::vector<int> state_position(dim_state); // Position of state var
std::vector<int> forward_position(dim_forward); // Position of forward var
std::map<std::string, int> original_map; // Map the name of variable to its position
std::vector<int> var_role(var_foc); //Vector stores the role of each variable (0: state, 1: other)
std::vector<double> starting_state(dim_state); // The state at time 0
std::map<std::string, int> eqn_map; //Map the name of equation to its position
std::vector<double> vec_kappa(T+1); //Exogenous variables
std::vector<double> shock_rf(T+1); // Exogenous for shock FFR














